package shuaige.jdk.多线程.base.线程类方法使用示例.中断线程;

class 需要中断的线程1 extends Thread {
    @Override
    public void run() {
        int n = 0;
        while (!isInterrupted()) {
            n++;
            System.out.println(n + " hello!");
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                System.out.println("HelloThread break");
                break;
            }
        }
    }
}
